<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>辞职申请详情</title>
    <link rel="stylesheet" href="/Sys/css/font.css">
    <link rel="stylesheet" href="/Sys/css/xadmin.css">
    <link rel="stylesheet" href="/Sys/css/layui.css">
    <script src="/Sys/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/Sys/js/jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="/Sys/js/xadmin.js"></script>
    <style>
        .detail-container {
            padding: 20px;
        }
        .detail-item {
            margin-bottom: 15px;
            display: flex;
        }
        .detail-label {
            width: 100px;
            text-align: right;
            margin-right: 10px;
            color: #666;
        }
        .detail-content {
            flex: 1;
            color: #333;
        }
        /*.reject-reason {*/
        /*    color: #ff5722;*/
        /*}*/
    </style>
</head>
<body>
<div class="detail-container">
    <div class="detail-item">
        <div class="detail-label">姓名：</div>
        <div class="detail-content" id="name"></div>
    </div>

    <div class="detail-item">
        <div class="detail-label">联系电话：</div>
        <div class="detail-content" id="phone"></div>
    </div>

    <div class="detail-item">
        <div class="detail-label">时间段（工作日）：</div>
        <div class="detail-content" id="timeSlot"></div>
    </div>

<!--    <div class="detail-item">-->
<!--        <div class="detail-label">状态：</div>-->
<!--        <div class="detail-content" id="status"></div>-->
<!--    </div>-->

    <div class="detail-item" id="remarkDiv" >
        <div class="detail-label">原因：</div>
        <div class="detail-content reject-reason" id="remark"></div>
    </div>
</div>

<script>
layui.use(['layer'], function(){
    var layer = layui.layer;
    
    // 获取URL中的ID
    var id = getUrlParam('id');
    
    // 加载辞职申请详情
    $.ajax({
        url: '/Sys/getResign/' + id,
        type: 'GET',
        dataType: 'json',
        success: function(res){
            if(res.code === 0){
                var data = res.data;
                $('#name').text(data.name);
                $('#phone').text(data.phone);
                $('#timeSlot').text(data.timeSlot);
                
                // 设置状态显示
                var statusText = '';
                switch(data.status) {
                    case 0:
                        statusText = '待审批';
                        break;
                    case 1:
                        statusText = '已通过';
                        break;
                    case -1:
                        statusText = '已驳回';
                        break;
                    default:
                        statusText = '未知状态';
                }
                $('#status').text(statusText);
                
                // 如果有备注，显示备注区域
                if(data.remark){
                    // $('#remarkDiv').show();
                    $('#remark').text(data.remark);
                }
            }else{
                layer.msg(res.msg || '获取辞职申请详情失败');
            }
        },
        error: function() {
            layer.msg('服务器错误，请联系管理员');
        }
    });
});

// 获取URL参数
function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return decodeURI(r[2]); return null;
}
</script>
</body>
</html> 